package com.websocet.service.impl;

import com.websocet.Utils.MinioUtil;
import com.websocet.config.MinioConfig;
import com.websocet.service.UploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;

@Slf4j
@Service
public class UploadServiceImpl implements UploadService {

    @Override
    public String uploadBytesByMinIO(MultipartFile file) {
        return MinioUtil.uploadFile(file,MinioConfig.BUCKET_NAME);
    }

    @Override
    public InputStream getMinioFile(String objectName) {
        return MinioUtil.getMinioFile(MinioConfig.BUCKET_NAME,objectName);
    }
}
